package com.maven.qqspider.common;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Constant {

	/** package_i18n="settings.i18n" */
	public final static String PACKAGE_I18N = "settings" + getDot() + "i18n";

	/** i18n_bundle_name="settings.i18n.appBundle" */
	public static final String I18N_BUNDLE_NAME = PACKAGE_I18N + getDot()
			+ "appBundle";

	/** LOG4J_FILE="settings/log4j.properties" */
	public static final String LOG4J_FILE = "settings/log4j.properties";

	/** protocol_file="file:" */
	public static final String PROTOCOL_FILE = "file:";

	/** domain_name="com.maven" */
	public static final String DOMAIN_NAME = "com.maven";

	/** project_name="qqspider" */
	public static String PROJECT_NAME = "qqspider";

	/** package_root="com.maven.qqspider" */
	public static String PACKAGE_ROOT = DOMAIN_NAME + getDot() + PROJECT_NAME;

	public static String PACKAGE_RESOURSE = PACKAGE_ROOT + getDot()
			+ "resource";

	/** package_image="com.maven.qqspider.resource.image" */
	public final static String PACKAGE_IMAGE = PACKAGE_RESOURSE + getDot()
			+ "image";

	public final static String[] AGES = { "不限", "1", "2", "3", "4", "5", "6",
			"7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17",
			"18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28",
			"29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39",
			"40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50",
			"51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61",
			"62", "63", "64", "65", "66", "67", "68", "69", "70", "71", "72",
			"73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83",
			"84", "85", "86", "87", "88", "89", "90", "91", "92", "93", "94",
			"95", "96", "97", "98", "99", "100", "101", "102", "103", "104",
			"105", "106", "107", "108", "109", "110", "111", "112", "113",
			"114", "115", "116", "117", "118", "119", "120" };

	public final static String[] MONTHS = { "不限", "1", "2", "3", "4", "5", "6",
			"7", "8", "9", "10", "11", "12" };

	public final static String[] DAYS_1TO29 = { "不限", "1", "2", "3", "4", "5",
			"6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17",
			"18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28",
			"29" };

	public final static String[] DAYS_1TO30 = { "不限", "1", "2", "3", "4", "5",
			"6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17",
			"18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28",
			"29", "30" };

	public final static String[] DAYS_1T031 = { "不限", "1", "2", "3", "4", "5",
			"6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17",
			"18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28",
			"29", "30", "31" };

	public final static String[] MARRIAGE = { "不限", "未婚", "已婚" };
	public final static Map<String, String> MARRIAGE_MAP = new HashMap<String, String>();
	static {
		MARRIAGE_MAP.put("不限", "-1");
		MARRIAGE_MAP.put("未婚", "1");
		MARRIAGE_MAP.put("已婚", "2");
	}

	public final static String[] SEX = { "不限", "男", "女" };
	public final static Map<String, String> SEX_MAP = new HashMap<String, String>();
	static {
		SEX_MAP.put("不限", "-1");
		SEX_MAP.put("男", "1");
		SEX_MAP.put("女", "2");
	}

	public final static String[] BT = { "请选择", "O型", "A型", "B型", "AB型", "其他" };
	public final static Map<String, String> BT_MAP = new HashMap<String, String>();
	static {
		BT_MAP.put("请选择", "-1");
		BT_MAP.put("O型", "0");
		BT_MAP.put("A型", "1");
		BT_MAP.put("B型", "2");
		BT_MAP.put("AB型", "3");
		BT_MAP.put("其他", "4");
	}

	public final static String[] AT = { "不限", "白羊座", "金牛座", "双子座", "巨蟹座",
			"狮子座", "处女座", "天秤座", "天蝎座", "射手座", "魔羯座", "水瓶座", "双鱼座"};
	public final static Map<String, String> AT_MAP = new HashMap<String, String>();
	static {
		AT_MAP.put("不限", "-1");
		AT_MAP.put("白羊座", "0");
		AT_MAP.put("金牛座", "1");
		AT_MAP.put("双子座", "2");
		AT_MAP.put("巨蟹座", "3");
		AT_MAP.put("狮子座", "4");
		AT_MAP.put("处女座", "5");
		AT_MAP.put("天秤座", "6");
		AT_MAP.put("天蝎座", "7");
		AT_MAP.put("射手座", "8");
		AT_MAP.put("魔羯座", "9");
		AT_MAP.put("水瓶座", "0");
		AT_MAP.put("双鱼座", "11");
	}

	// icon info
	/** icon_url="com/maven/qqspider/resource/image" */
	public static String ICON_DIR = dotToSlash(PACKAGE_IMAGE);

	/** app_icon="com/wateray/ipassbook/resource/image/gnome.png" */
	public static String APP_ICON = ICON_DIR + getSlash() + "gnome.png";

	/**
	 * @return "."
	 * */
	public static String getDot() {
		return ".";
	}

	/**
	 * @return "/"
	 * */
	public static String getSlash() {
		return "/";
	}

	public static String getQuestionMark() {
		return "?";
	}

	public static String dotToSlash(String oldString) {
		return oldString.replace(getDot(), getSlash());
	}

	public static String[] set2array(Set<String> set) {
		List<String> list = new ArrayList<String>();

		Iterator<String> it = set.iterator();
		while (it.hasNext()) {
			list.add(it.next());
		}

		return (String[]) list.toArray(new String[list.size()]);
	}
}
